home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2003 November / PCWK1103B.iso / DesignCAD 3D Max PLUS trial 30 / DATA1.CAB / Example_Files / Sample_Macros / 600_1_Start.d3m < prev    next >
Encoding:
Text File  |  2003-09-29  |  3.4 KB  |  150 lines

  1. ' This program calculates the amount of ceiling tile material
  2. ' needed for rooms based on their area.  It also adds info
  3. ' boxes to the drawing containing pricing materials and 
  4. ' calculated costs.
  5. '
  6. ' Small Area Info Boxes are placed on Layer 9
  7. ' Large Material Info Boxes are placed on Layer 10
  8. ' Tempoary Items are drawn on Layer 11, it should be left empty
  9. ' Attributes for Area to be calculated are on Layer 12
  10. ' Attributes for Length to be calculated are on Layer 13
  11. ' The Master Info Box is on Layer 14
  12. '
  13. ' This program initializes all variables, clears them, and
  14. ' checks for the 600.txt file.  If it exists, this file reads
  15. ' the values from it, and launches the small box program, 
  16. ' 600_2_Area.d3m.
  17. '
  18. ' If it does not find values, it launches 600_4_NoData.d3m instead.
  19. '
  20. ' Initialize Variables
  21.   Clear
  22.             ' Length and Area
  23.                 Len0 = 0
  24.                 Len1 = 0
  25.                 Len2 = 0
  26.                 Area1 = 0 
  27.                 Area2 = 0
  28.             ' MTee Variables
  29.                 MTeeN = 0
  30.                 MTeeC = 0
  31.                 MTeeN2 = 0    
  32.                 MTeeC2 = 0
  33.             ' 1.2CN Variables
  34.                 CN12 = 0
  35.                 CNC12 = 0 
  36.                 CN122 = 0
  37.                 CNC122 = 0
  38.             ' 1.6CN Variables
  39.                 CN6 = 0
  40.                 CN6C = 0 
  41.                 CN62 = 0
  42.                 CN6C2 = 0
  43.             ' ST Fix Variables
  44.                 STFix = 0
  45.                 STFixC = 0
  46.                 STFix2 = 0
  47.                 CTFixC2 = 0
  48.             ' RodsT Variables
  49.                 RodsT = 0
  50.                 RodsTC = 0
  51.                 RodsT2 = 0
  52.                 RodsTC2 = 0
  53.             ' Rods B Variables
  54.                 RodsB = 0
  55.                 RodsBC = 0
  56.                 RodsB2 = 0
  57.                 RodsBC2 = 0
  58.             ' Channel Variables
  59.                 AddLen = 0
  60.                 Chan = 0
  61.                 Chan2 = 0
  62.                 Chan2C = 0
  63.             ' Panel Variables
  64.                 Panel = 0
  65.                 Pan1 = 0
  66.                 Pan2 = 0
  67.                 Pan3 = 0
  68.                 PanNum = 0
  69.                 PanNum2 = 0
  70.             ' String Variables used in large Info Boxes
  71.                 MTeeN2$ = ""
  72.                 MTeeC2$ = ""
  73.                 CN122$ = ""
  74.                 CNC122$ = ""
  75.                 CN62$ = ""
  76.                 CN6C2$ = ""
  77.                 STFix2$ = ""
  78.                 STFixC2$ = ""
  79.                 RodsT2$ = ""
  80.                 RodsTC2$ = ""
  81.                 RodsB2$ = ""
  82.                 RodsBC2$ = ""
  83.                 Chan2$ = ""
  84.                 Chan2C$ = ""
  85.                 Pan3$ = ""
  86.             ' Misc New Variables
  87.                 RType = 0
  88.                 a = 0
  89.                 b = 0
  90.                 PanNum = 0
  91. ' Startup Stuff Here
  92.             ' Get Drawing Width
  93.                 MinnX = Sys(120)
  94.                 MaxxX = Sys(122)
  95.                 Diff = MaxxX - MinnX
  96.                 Diff = Diff * .25
  97.                 if Diff <= 0 then Diff = 5
  98.                 '
  99.             ' Set text size to 1
  100.                 Sys(12) = 1
  101.                 '
  102.             ' Prevent users from starting commands while the program is running
  103.                 Sys(470) = 1
  104.                 '
  105.             ' Make sure drawing is not empty before continuing
  106.                 if Sys(9) = 0 then
  107.                     Message "Please use this program only in a drawing with entities."
  108.                     goto Ender
  109.                 endif
  110.             '
  111.             ' Setup Default Drawing Options
  112.             ' Line Width is always 0
  113.                 Sys(6) = 0
  114.             ' Line Type is always 0
  115.                 Sys(4) = 0
  116.             ' Text in Current Color Yes
  117.                 Sys(254) = 1
  118.             ' Text in Current Layer Yes
  119.                 Sys(255) = 1
  120.             ' Text Style is normal
  121.                 Sys(258) = 0
  122. ' Read Values from ASCII text file 
  123. ' Based on RType chosen by user above
  124.         On Error goto KDW
  125.         open "i", 1, "*\sample Macros\600.txt"
  126. ' Assign #s found to Variables
  127.     Input #1, AddLen
  128.     Input #1, TH
  129.     Input #1, PanNum2
  130.     Input #1, PanNum
  131. ' Close File
  132.     Close #1
  133. '
  134.  
  135. ' Values were found in the ASCII text file, which means the user
  136. ' has run this program before, so go onto the area macro.
  137.     Run "600_2_Area.d3m"
  138. ' This BSC is over
  139. Ender:
  140. end
  141.  
  142. ' This macro had some trouble opening the 600.txt file, which most
  143. ' likely does not exist, so go to the other macro which prompts the 
  144. ' user for variables, and creates the file.
  145. KDW:
  146.     Run "600_4_NoData.d3m"
  147. ' This BSC is over
  148. end
  149.  
  150.